@extends('backend::layout')
@section('title',$page_title)
@section('content')
    @component('backend::component.form.form')
        @slot('page_title') {{$page_title}} @endslot
        @slot('icon') hcl-change1 @endslot
        @slot('formId') change @endslot
        @slot('action'){{$url}}@endslot

        @component('backend::component.form.form-group')
            @slot('title') 变更类型名称 @endslot
            @component('backend::component.form.input')
                @slot('name') title @endslot
                @slot('value') {{$info->title ?? ''}} @endslot
            @endcomponent
        @endcomponent

        @component('backend::component.form.form-group')
            @slot('title') 变更类型图标 @endslot
            <div class="layui-input-block">
                <input type="text" id="iconPicker" name="icon" class="form-control" value="{{$info->icon ?? 'hcl-default'}}">
             </div>
        @endcomponent

        @component('backend::component.form.form-group')
            @slot('title') 类型 @endslot
            <div>
                @foreach(['0'=>'其他','1'=>'奖励'] as $value=>$title)
                    @component('backend::component.radio')
                        @slot('title') {{$title}} @endslot
                        @slot('name') type @endslot
                        @slot('value') {{$value}} @endslot
                        @if($value == ($info->type ?? 0))
                            @slot('checked') checked @endslot
                        @endif
                    @endcomponent
                @endforeach
            </div>
        @endcomponent

        @component('backend::component.form.form-group')
            @slot('title') 状态 @endslot
            <div>
                @foreach(['0'=>'禁用','1'=>'启用'] as $value=>$title)
                    @component('backend::component.radio')
                        @slot('title') {{$title}} @endslot
                        @slot('name') status @endslot
                        @slot('value') {{$value}} @endslot
                        @if($value == ($info->status ?? 1))
                            @slot('checked') checked @endslot
                        @endif
                    @endcomponent
                @endforeach
            </div>
        @endcomponent
        @slot('buttons')
            @component('backend::component.form.button')
                @slot('title') 提交 @endslot
                @slot('params') {"formId":"#change"} @endslot
                @slot('class') btn-min-width ajax-form @endslot
            @endcomponent
            @component('backend::component.form.button')
                @slot('title') 重置 @endslot
                @slot('type') reset @endslot
                @slot('color') danger @endslot
                @slot('class') btn-min-width @endslot
            @endcomponent
        @endslot
    @endcomponent
@endsection
@push('scripts')
    <script>
        layui.use(['iconPicker'], function(){
            var iconPicker = layui.iconPicker;
            iconPickerMenu();
            function  iconPickerMenu() {
                iconPicker.render({
                    // 选择器，推荐使用input
                    elem: '#iconPicker',
                    // 数据类型：fontClass/unicode，推荐使用fontClass
                    type: 'fontClass',
                    // 是否开启搜索：true/false
                    search: true,
                    iconClass:'hcl',
                    // 是否开启分页
                    page: true,
                    // 每页显示数量，默认12
                    limit: 12
                });
                iconPicker.checkIcon('iconPicker', '{{$info->icon ?? "hcl-default"}}','hcl');
            }
        });
    </script>
@endpush